package com.lnsf.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	private static final String DATE_FORMAT = "yyyy-MM-dd";
	private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
	private static final String TIME_FORMAT = "HH:mm:ss";
	
	
	private static SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
	private static SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATETIME_FORMAT);
	private static SimpleDateFormat timeFormat = new SimpleDateFormat(TIME_FORMAT);
	
	
	public static Date getDateFromString(String date_s) {
		Date date = null ;
		try {
			date = dateFormat.parse(date_s);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return date ; 
	}
	
	public static String getStringFromDate(Date date) {
			String str = null;
		try {
			str = dateFormat.format(date);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str ; 
	}
	
}
